<!DOCTYPE html>
<html lang="en">
    <head>
        <?php require_once('../modulos/header.php'); ?> 
        
            <body  style="background-image: url(../img/rayas_verticales.jpg); background-size: 100%;">
               
                <?php require_once('../modulos/navbar.php'); ?>
                
                <div class='row'>
                    <br><br><br>
                    <div class="col-md-8 text-center col-lg-offset-2" style="background: #e7e7e7; border-radius: 15px;">
                        <?php 
                        require_once '../conex.php';
                            $idCal = $_POST['idOpo'];
                        ?>
                        <a href="../vistas/mod_empleado.php">
                            <div class="col-md-1 text-left" style="height: 50px; padding-top: 10px">
                                <strong>Volver</strong>
                            </div>
                        </a>
                        <h3>Modificar Empleado</h3>
                        <br>
                        <table id="tablita" class="table">
                                <thead>
                                    <tr style="background-color: rgba(86,61,124,.15);">
                                        <th>#</th>
                                        <th>Nombre</th>
                                        <th>Apellido</th>
                                        <th>Teléfono</th>
                                        <th>Dirección</th>
                                        <th>Correo</th>
                                        <th>Cargo</th>
                                        <th>Sueldo</th>
                                    </tr>
                                </thead>
                                <tbody style="background-color: #f9f9f9;">
                                    <?php 
                                        $qr = "SELECT * FROM empleados WHERE empleados.idEmpleados = '$idCal'";
                                        $ejecutar = mysql_query($qr);

                                        while ($fila = mysql_fetch_array($ejecutar)){ ?>     
                                    <tr>
                                        <th>
                                            <?php echo $fila['identificacion']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['nombre']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['apellido']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['telefono']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['direccion']; ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['correo']; ?>
                                        </th>
                                        <th>
                                            <?php 
                                            $id2 = $fila['idEmpleados'];
                                            $qr2 = "SELECT descripcion FROM cargos WHERE cargos.idCargo = $id2";
                                            $ejecutar2 = mysql_query($qr2);
                                            $fila2 = mysql_fetch_array($ejecutar2); 
                                            echo $fila2['descripcion'];
                                            ?>
                                        </th>
                                        <th>
                                            <?php echo $fila['sueldo']; ?>
                                        </th>
                                        <?php
                                        }
                                        ?>                 
                                </tbody>
                            </table> 
                        <br>
                        <form method="POST" action="../editar/empleado.php">
                            <div class="col-md-6">
                                <label>Nombre:</label>
                                <input name="name" type="text" class="form-control" placeholder="María" required>
                                <label>Apellido:</label>
                                <input name="apellido" type="text" class="form-control" placeholder="López" required>
                                <label>Identificación:</label>
                                <input name="iden" type="text" class="form-control" placeholder="ADFL22" required>
                                <label>Teléfono:</label>
                                <input name="tlf" type="number" class="form-control" placeholder="0286123456" required>
                            </div>
                            <div class="col-md-6">
                                <label>Dirección:</label>
                                <input name="dir" type="text" class="form-control" placeholder="Villa Asia, Calle Merú. Piso 02" required>
                                <label>Correo electrónico:</label>
                                <input name="email" type="text" class="form-control" placeholder="algo@domain.com" required> 
                                <label>Sueldo:</label>
                                <input name="sueldo" type="number" step="0.0001" class="form-control" placeholder="13.0000" required>
                                    <?php 
                                    require_once '../conex.php';
                                        $qr2 = "SELECT * FROM cargos";
                                        $ejecutar2 = mysql_query($qr2);
                                    ?>
                                    <label>Cargo:</label>
                                    <select class="form-control" name="cargo" required>
                                        <?php 
                                        while ($fila = mysql_fetch_array($ejecutar2)){ ?>
                                        <option id="<?php echo $fila['idCargo']; ?>" value="<?php echo $fila['idCargo']; ?>">
                                            <?php echo $fila['descripcion']; 
                                            } 
                                            mysql_close();   
                                        ?>
                                        </option>
                                    </select>
                                    <br>
                                <br>
                                <input name="idEm" value=" <?php echo $idCal; ?> " style="display: none;">
                                <button type="submit" class="btn btn-success"> Guardar</button>
                            </div>   
                        </form>
                </div> <!-- /container -->          
            </div> 
       
        <script type='text/javascript' src="../js/jquery.min.js"></script>
        <script type='text/javascript' src="../js/bootstrap.js"></script>
        <script type='text/javascript' src="../js/bootstrap.min.js"></script>
        
        <script type="text/javascript">
            function redirect(){
                window.location = "../modificar/mod_oponentes.php";
            }
        </script>
    </body>
</html>